﻿package mortal.game.view.mainUI.zazen
{
    import com.greensock.*;
    import com.mui.controls.*;
    import com.mui.manager.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.map3D.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class RightDownShrinkView extends View
    {
        protected var _titleImageName:String;
        private var _extendImageName:String;
        protected var _bodySprite:GSprite;
        private var _btnUnExpand:GLoadedButton;
        private var _spRWZZ:ToolTipSprite;
        private var _btnExpandBg:GLoadedButton;
        private var _btnExpand:GLoadedButton;
        private var _bmpRWZZ:GImageBitmap;
        private var _tween:TimelineLite;

        public function RightDownShrinkView(param1:String, param2:String)
        {
            this._titleImageName = param1;
            this._extendImageName = param2;
            mouseEnabled = true;
            this.layer = LayerManager.uiLayer;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bodySprite = UICompomentPool.getUICompoment(GSprite) as GSprite;
            this._bodySprite.mouseChildren = true;
            this._bodySprite.mouseEnabled = true;
            this.addChild(this._bodySprite);
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.GuajiTongjiBg, 0, 0, this._bodySprite));
            if (this._titleImageName)
            {
                pushUIToDisposeVec(UIFactory.gImageBitmap(this._titleImageName, 70, 19, this._bodySprite));
            }
            this._btnUnExpand = UIFactory.gLoadedButton(ImagesConst.taskTrackRight_upSkin, 267, 14, 20, 20, this._bodySprite);
            this._spRWZZ = UICompomentPool.getUICompoment(ToolTipSprite) as ToolTipSprite;
            this._spRWZZ.x = 300;
            this._spRWZZ.y = 9;
            this._spRWZZ.mouseChildren = true;
            this._spRWZZ.mouseEnabled = true;
            this.addChild(this._spRWZZ);
            this._btnExpandBg = UIFactory.gLoadedButton(ImagesConst.taskTrack_upSkin, 0, 0, 35, 101, this._spRWZZ);
            this._btnExpand = UIFactory.gLoadedButton(ImagesConst.taskTrackLeft_upSkin, 11, 6, 20, 20, this._spRWZZ);
            if (this._extendImageName)
            {
                this._bmpRWZZ = UIFactory.gImageBitmap(this._extendImageName, 13, 29, this._spRWZZ);
            }
            this._btnUnExpand.configEventListener(MouseEvent.CLICK, this.unExpandHandler);
            this._btnUnExpand.toolTipData = Language.getString(35387);
            this._spRWZZ.configEventListener(MouseEvent.CLICK, this.expandHandler);
            this._spRWZZ.toolTipData = Language.getString(35388);
            return;
        }// end function

        private function unExpandHandler(param1 = null) : void
        {
            if (this._tween != null && this._tween.active)
            {
                return;
            }
            this._tween = new TimelineLite();
            this._tween.append(TweenLite.to(this._bodySprite, 0.2, {x:300}));
            this._tween.append(TweenLite.to(this._spRWZZ, 0.1, {x:262}));
            return;
        }// end function

        private function expandHandler(param1 = null) : void
        {
            if (this._tween != null && this._tween.active)
            {
                return;
            }
            this._tween = new TimelineLite();
            this._tween.append(TweenLite.to(this._spRWZZ, 0.1, {x:300}));
            this._tween.append(TweenLite.to(this._bodySprite, 0.2, {x:0}));
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._bodySprite.dispose(param1);
            this._bodySprite = null;
            this._btnUnExpand.dispose(param1);
            this._btnUnExpand = null;
            this._spRWZZ.dispose(param1);
            this._spRWZZ = null;
            this._btnExpandBg.dispose(param1);
            this._btnExpandBg = null;
            this._btnExpand.dispose(param1);
            this._btnExpand = null;
            if (this._bmpRWZZ)
            {
                this._bmpRWZZ.dispose(param1);
                this._bmpRWZZ = null;
            }
            if (this._tween != null)
            {
                this._tween.kill();
                this._tween = null;
            }
            super.disposeImpl(param1);
            return;
        }// end function

        override public function stageResize() : void
        {
            this.x = SceneRange.display.width - 297;
            this.y = SceneRange.display.height - 240;
            return;
        }// end function

    }
}
